<%@page import="cn.com.entity.Consumer"%>
<%@page import="cn.com.entity.Doctor"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户修改个人信息页面</title>
<style type="text/css">
#main{
	margin-top: 10%;
	color: #03C;
}
</style>
<script type="text/javascript">
function yanzheng(){
	var consumerpwd=document.getElementById("consumerpwd").value;
	var qrmima=document.getElementById("qrmima").value;
	var reg=/^[A-Za-z0-9]{4,25}$/; 
	if(!reg.test(consumerpwd)){
		alert("密码只能是字母和数字，必须在4到25位之间");
		return false;
	}
	if(qrmima!=consumerpwd||consumerpwd==""||qrmima==""){
		alert("请确认两次输入的密码一致,并且都不能为空");
		return false;
	}
	var consumerage=document.getElementById("consumerage").value;
	if(isNaN(consumerage)||consumerage<=0||consumerage>=150||consumerage==""){
		alert("请您填写合法的年龄");
		return false;
	}
	var consumerphone=document.getElementById("consumerphone").value;
	var reg1=/^(1(([35][0-9])|(47)|[8][01236789]))\d{8}$/;
	if(!reg1.test(consumerphone)){
		alert("请您填写真实的手机号码，以便我们能及时联系到您！");
		return false;
	}
	var reg2=/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
	var consumeremail=document.getElementById("consumeremail").value;
	if(!reg2.test(consumeremail)){
		alert("请您填写正确的邮箱！");
		return false;
	}
	
	
	return true;	
	
}
</script>
</head>
<body>
<div id="main">
<%
if(session.getAttribute("consumerlogin")!=null){
if(session.getAttribute("consumerone")!=null){	
Consumer c=(Consumer)session.getAttribute("consumerone");
%>
<form method="post" action="updateconsumeraction" onsubmit="return yanzheng()">
<h2 align="center">修改个人信息</h2>
<center>${consumermsg}</center>
	<table align="center" width="30%" cellspacing="10px" style="font-size: 20px">
		<tr>
			<td>密码：</td>
			<td>
			<input type="hidden" name="consumer.consumerid"  value="<%=c.getConsumerid() %>" />
			<input type="hidden" name="consumer.consumername"  value="<%=c.getConsumername() %>" />
			<input type="text" name="consumer.consumerpwd"  id="consumerpwd" value="<%=c.getConsumerpwd()%>"/></td>
		</tr>
		<tr>
			<td>确认密码：</td>
			<td><input type="text" id="qrmima"  /></td>
		</tr>
		
		<tr>
			<td>年龄：</td>
			<td>
			<input type="hidden" name="consumer.realname"  value="<%=c.getRealname() %>" />
			<input type="text" id="consumerage" value="<%=c.getConsumerage()%>" name="consumer.consumerage"/></td>
		</tr>
		
		<tr>
			<td>手机号码：</td>
			<td>
			<input type="hidden" name="consumer.consumersex"  value="<%=c.getConsumersex() %>" />
			<input type="hidden" name="consumer.consumeridcard"  value="<%=c.getConsumeridcard() %>" />
			<input type="text" id="consumerphone" value="<%=c.getConsumerphone()%>" name="consumer.consumerphone"/></td>
		</tr>
		
		<tr>
			<td>个人邮箱：</td>
			<td>
			<input type="text" id="consumeremail" value="<%=c.getConsumeremail()%>" name="consumer.consumeremail"/></td>
		</tr>
		
		<tr>
			<td colspan="2"><input type="submit"  style="font-size:20px; color:#FFF; background-image: url(images/lanseanniu.jpg);" value=" 保 存 " /></td>
		</tr>
	</table>
	
</form>

<%} 
}%>
</div>
</body>
</html>